<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class EventLog extends BaseModel
{
    protected $table = 'event_log';

    const CREATED_AT = 'add_time';
    const UPDATED_AT = null;

    protected $dateFormat = 'U';

    protected $fillable = [
        'event',
        'params',
        'request_params',
        'ip'
    ];

    protected $casts = [
        'params'=>'array',
        'request_params'=>'array',
    ];

    /**
     * 通知事件文本
     * event_text
     */
    public function getEventTextAttribute()
    {
        switch ($this->event){
            case \App\Events\OrderOffered::class:
                return '师傅对订单报价';
            default:
                return $this->event;
        }
    }
}
